package com.kinghood.productcenter.controller.product;

import com.kinghood.infrastructure.model.KingHoodResponseVO;
import com.kinghood.productcenter.common.model.dto.base.ListLabelQueryDTO;
import com.kinghood.productcenter.common.model.dto.product.BusinessLogQueryDTO;
import com.kinghood.productcenter.service.product.IBusinessLogService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

/**
 * <p>
 * 业务日志表 前端控制器
 * </p>
 *
 * @author KingHood
 * @since 2023-12-20
 */
@RestController
@RequestMapping("/businessLog")
public class BusinessLogController {
    @Resource
    private IBusinessLogService businessLogService;

    /**
     * 列表
     *
     * @author jp
     * @date 2023/12/20
     */
    @PostMapping("/listBusinessLog")
    public KingHoodResponseVO listBusinessLog(@RequestBody BusinessLogQueryDTO param) {
        return KingHoodResponseVO.success(businessLogService.listBusinessLog(param));
    }

    /**
     * 业务类型列表
     *
     * @return @return {@link KingHoodResponseVO }
     * @author jp
     * @date 2024/01/09 18:56
     */
    @RequestMapping("/listBusinessLogOperateType")
    public KingHoodResponseVO listBusinessLogOperateType() {
        return KingHoodResponseVO.success(businessLogService.listBusinessLogOperateType());
    }

    /**
     * 下载业务日志
     *
     * @param param    参数
     * @param response 回答
     * @return
     * @author jp
     * @date 2024/01/10 17:37
     */
    @PostMapping("/downloadBusinessLog")
    public void downloadBusinessLog(@RequestBody BusinessLogQueryDTO param, HttpServletResponse response) {
        businessLogService.downloadBusinessLog(param, response);
    }
}
